package o;

import java.security.InvalidKeyException;
import java.security.Key;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;

public class doh {
    private static Key ॱ(byte[] bArr, boolean z) throws NoSuchAlgorithmException, InvalidKeySpecException {
        KeyFactory instance = KeyFactory.getInstance("RSA");
        if (z) {
            return instance.generatePublic(new X509EncodedKeySpec(bArr));
        }
        return instance.generatePrivate(new PKCS8EncodedKeySpec(bArr));
    }

    public static byte[] ˊ(byte[] bArr, String str) throws IllegalArgumentException, InvalidKeySpecException, NoSuchAlgorithmException, NoSuchPaddingException, NoSuchProviderException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
        Key ॱ = ॱ(doa.ˎ(str.toCharArray()), true);
        Cipher instance = Cipher.getInstance("RSA/NONE/OAEPWithSHA256AndMGF1Padding", "BC");
        instance.init(1, ॱ);
        return instance.doFinal(bArr);
    }
}
